package guava;

import com.google.common.hash.BloomFilter;
import com.google.common.hash.Funnel;
import com.google.common.hash.Funnels;
import com.google.common.hash.PrimitiveSink;

/**
 * 描述
 *
 * @author lgb
 * @date 2020/11/15
 **/
public class TestBloomFilter {

    public static void main(String[] args) {
        BloomFilter<Long> filter = BloomFilter.create(Funnels.longFunnel(), 100);

        for (int i = 0; i < 50; i++) {
            filter.put((long) i);
        }
        for (int i = 0; i < 100; i++) {
            System.out.println("i:"+i+",exists:" + filter.mightContain(((Integer)i).longValue()));
        }
    }
}
